package com.speily.lock.framework;

import com.speily.lock.exception.LimitException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.util.HashMap;
import java.util.Map;

/**
 * 异常控制
 * <p></p>
 *
 * @author SPL
 * @since 2019/12/30 17:55
 */
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(LimitException.class)
    public Map limitExceptionHandler(LimitException e) {
        Map<String,Object> res = new HashMap<>();
        res.put("code", "403");
        res.put("msg", e.getMessage());
        return res;
    }
}
